﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EmoneyWeiXinEntity;
using EmoneyWeiXinDAL;
namespace EmoneyWeiXinBLL
{
    public class NewsReportManager
    {
        public NewsReportEntity getNewsReportOne(string id)
        {
            NewsReportfbDal dal = new NewsReportfbDal();
            return dal.getNewsReportOne(id);
        }

        public static List<NewsReportfbEntity> getNewsReportfbList(int pindex, int psize, out int total, string memutype, string pubdate1, string pubdate2, int userId)
        {
            return NewsReportfbDal.getNewsReportfbList(pindex, psize, out total, memutype, pubdate1, pubdate2, userId);
        }
        public static NewsReportfbEntity getNewsReportfbByID(int id)
        {
            var list = NewsReportfbDal.getNewsReportfbListByID(id);
            if (list != null && list.Count > 0)
                return list[0];
            else
                return new NewsReportfbEntity();
        }
        public static int UpdateNewsReportfb(NewsReportfbEntity obj)
        {
            return NewsReportfbDal.UpdateNewsReportfb(obj);
        }
        public static int UpdateValidNewsReportfb(int id, int vaild)
        {
            NewsReportfbEntity news = new NewsReportfbEntity();
            news = getNewsReportfbByID(id);
            news.isvalid = vaild;
            return UpdateNewsReportfb(news);
        }

        public static List<NewsReportEntity> getNewsReportList(int pindex, int psize, out int total, string memutype, string pubdate1, string pubdate2, string title, int weixinid)
        {
            return NewsReportDal.getNewsReportList(pindex, psize, out  total, memutype, pubdate1, pubdate2, title, weixinid);
        }
        public static List<NewsReportEntity> getNewsReportList2(int pindex, int psize, out int total, string memutype, string pubdate1, string pubdate2, string title, int weixinid)
        {
            return NewsReportDal.getNewsReportList2(pindex, psize, out  total, memutype, pubdate1, pubdate2, title, weixinid);
        }
        public static NewsReportEntity getNewsReportByID(int id)
        {
            var list = NewsReportDal.getNewsReportListByID(id);
            if (list != null && list.Count > 0)
                return list[0];
            else
                return new NewsReportEntity();
        }
        public static int UpdateNewsReport(NewsReportEntity obj)
        {
            return NewsReportDal.UpdateNewsReport(obj);
        }
        public static int UpdateValidNewsReport(int id, int vaild)
        {
            return NewsReportDal.UpdateValidNewsReport(id, vaild);
        }

        /// <summary>
        /// 获取某类资讯的最新一条的发布日期
        /// </summary>
        /// <param name="typeid"></param>
        /// <returns></returns>
        public DateTime getList_date(int typeid)
        {
            return new NewsReportDal().getList_date(typeid);
        }

        public IList<NewsReportEntity> getNewsForClientDayByDay(string meid, string day, int pre)
        {
            return new NewsReportDal().getNewsForClientDayByDay(meid, day, pre);
        }

        public IList<NewsReportEntity> getNewsForClient2(string meid, bool latestDay, int size, int index)
        {
            return new NewsReportDal().getNewsForClient2(meid, latestDay, size, index);
        }
    }
}
